package cc.facesign.admin.controller;


import cc.facesign.admin.bean.vo.ConfSignVo;
import cc.facesign.admin.service.StaConfSignService;
import cc.facesign.admin.utils.PowerUtils;
import cc.facesign.common.utils.bean.R;
import com.alibaba.excel.util.DateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-05-09
 */
@RestController
@RequestMapping("/sta/confsign")
@Api(description = "统计信息管理")
public class StaConfSignController {

    @Autowired
    private PowerUtils powerUtils;

    @Autowired
    private StaConfSignService confSignService;

    /**
     * 只能查询当前登录的用户所管理的部门的会议信息
     * 详见 ConfSignVo
     * @param d
     * @return
     * @throws ParseException
     */
    @ApiOperation("获取指定日期的会议统计信息")
    @GetMapping("/getConfsignByDate")
    public R getConfsignByDate(String d) throws ParseException {

        Date date = DateUtils.parseDate(d);
        List<ConfSignVo> vo = confSignService.getByDate(date);

        return R.ok().data("data", vo);
    }
}

